﻿using com.guojin.mj.net.message.game;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class CompareCardAniPage : MonoBehaviour {

    public RawImage leftHead;
    public RawImage rightHead;
    public GameObject LeftCard;
    public GameObject RightCard;

	void Start () {	
	}

    public void InitCompareCardAni(BetInfoRet bs)
    {
        //leftHead.texture = GameData.GetInstance().playerDic[bs.UserID.ToString()].headphotoImg;
        //rightHead.texture = GameData.GetInstance().playerDic[bs.ThanIndex.ToString()].headphotoImg;
        //if (bs.UserID  == GameData.GetInstance().UserID && GameData.GetInstance().playerDic[bs.UserID.ToString()].isLookCard)
        //{
        //    for (int i = 0; i <GameData.GetInstance().playerDic[bs.UserID.ToString()].Cards.Count; i++)
        //    {           
        //        if (GameData.GetInstance().playerDic[bs.UserID.ToString()].Cards[i] > 52)
        //        {
        //            GameData.GetInstance().playerDic[bs.UserID.ToString()].Cards[i] = GameData.GetInstance().playerDic[bs.UserID.ToString()].Cards[i] % 52;
        //        }
        //    }
        //    LeftCard.transform.GetChild(0).GetComponent<Image>().sprite = Resources.Load<Sprite>("Card/"+GameData.GetInstance().playerDic[bs.UserID.ToString()].Cards[0].ToString());
        //    LeftCard.transform.GetChild(1).GetComponent<Image>().sprite = Resources.Load<Sprite>("Card/" + GameData.GetInstance().playerDic[bs.UserID.ToString()].Cards[1].ToString());
        //    LeftCard.transform.GetChild(2).GetComponent<Image>().sprite = Resources.Load<Sprite>("Card/" + GameData.GetInstance().playerDic[bs.UserID.ToString()].Cards[2].ToString());
        //}
        //else
        //{
        //    LeftCard.transform.GetChild(0).GetComponent<Image>().sprite = Resources.Load<Sprite>("Card/back");
        //    LeftCard.transform.GetChild(1).GetComponent<Image>().sprite = Resources.Load<Sprite>("Card/back");
        //    LeftCard.transform.GetChild(2).GetComponent<Image>().sprite = Resources.Load<Sprite>("Card/back");
        //}

        //if (bs.ThanIndex== GameData.GetInstance().UserID && GameData.GetInstance().playerDic[bs.UserID.ToString()].isLookCard)
        //{
        //    for (int i = 0; i < GameData.GetInstance().playerDic[bs.ThanIndex.ToString()].Cards.Count; i++)
        //    {       
        //        if (GameData.GetInstance().playerDic[bs.ThanIndex.ToString()].Cards[i] > 52)
        //        {
        //            GameData.GetInstance().playerDic[bs.ThanIndex.ToString()].Cards[i] = GameData.GetInstance().playerDic[bs.ThanIndex.ToString()].Cards[i] % 52;
        //        }
        //    }
        //    RightCard.transform.GetChild(0).GetComponent<Image>().sprite = Resources.Load<Sprite>("Card/" + GameData.GetInstance().playerDic[bs.ThanIndex.ToString()].Cards[0].ToString());
        //    RightCard.transform.GetChild(1).GetComponent<Image>().sprite = Resources.Load<Sprite>("Card/" + GameData.GetInstance().playerDic[bs.ThanIndex.ToString()].Cards[1].ToString());
        //    RightCard.transform.GetChild(2).GetComponent<Image>().sprite = Resources.Load<Sprite>("Card/" + GameData.GetInstance().playerDic[bs.ThanIndex.ToString()].Cards[2].ToString());
        //}
        //else
        //{
        //    RightCard.transform.GetChild(0).GetComponent<Image>().sprite = Resources.Load<Sprite>("Card/back");
        //    RightCard.transform.GetChild(1).GetComponent<Image>().sprite = Resources.Load<Sprite>("Card/back");
        //    RightCard.transform.GetChild(2).GetComponent<Image>().sprite = Resources.Load<Sprite>("Card/back");
        //}

        //if (bs.ThanResult == 0)
        //{
        //    LeftCard.transform.GetChild(3).GetComponent<Image>().sprite = Resources.Load<Sprite>("Type/比牌赢");
        //    RightCard.transform.GetChild(3).GetComponent<Image>().sprite = Resources.Load<Sprite>("Type/比牌输");
        //}
        //else if(bs.ThanResult == 1)
        //{
        //    LeftCard.transform.GetChild(3).GetComponent<Image>().sprite = Resources.Load<Sprite>("Type/比牌输");
        //    RightCard.transform.GetChild(3).GetComponent<Image>().sprite = Resources.Load<Sprite>("Type/比牌赢");
        //}
    }

    public void Destory()
    {
        Destroy(gameObject);
    }
}
